package com.example.botany_api.service;

import com.example.botany_api.bean.Gallery;
import com.example.botany_api.bean.Meaty;
import com.example.botany_api.bean.MeatyType;
import com.example.botany_api.mapper.MeatyMapper;
import com.example.botany_api.mapper.MeatyMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 漫画忧作
 * @Date 2022/11/2 23:55
 * @Version 1.0
 */
@Service
public class MeatyService {
    @Autowired
    MeatyMapper meatyMapper;

    //    分页
    public List getMeatyType(String type_name, int current, int size) {
        return meatyMapper.getMeatyType(type_name, current, size);
    }

    //    总数
    public int getMeatyTypeTotal(String type_name) {
        return meatyMapper.getMeatyTypeTotal(type_name);
    }

    //    删除分类
    public int dl_MeatyType(int id) {
        return meatyMapper.dl_MeatyType(id);
    }


    //    添加分类
    public int add_MeatyType(MeatyType meatyType) {
        return meatyMapper.add_MeatyType(meatyType);
    }

    //    修改分类
    public int up_MeatyType(MeatyType meatyType) {
        return meatyMapper.up_MeatyType(meatyType);
    }


    //    管理员多肉管理
//    分页
    public List getMeaty(String name, String summary, int type_id, int current, int size) {
        return meatyMapper.getMeaty(name, summary, type_id, current, size);
    }

    //    总数
    public int getMeatyTotal(String name, String summary, int type_id) {
        return meatyMapper.getMeatyTotal(name, summary, type_id);
    }

    //    删除多肉管理
    public int dl_Meaty(int id) {
        return meatyMapper.dl_Meaty(id);
    }


    //    添加多肉管理
    public int add_Meaty(Meaty meaty) {
        return meatyMapper.add_Meaty(meaty);
    }

    //    修改多肉管理
    public int up_Meaty(Meaty meaty) {
        return meatyMapper.up_Meaty(meaty);
    }

    public List getOptionList() {
        return meatyMapper.getOptionList();
    }

    public List meatyAndType(int id) {
        return meatyMapper.meatyAndType(id);
    }

    public List curingAndType(int id) {
        return meatyMapper.curingAndType(id);
    }

    public List informationAndType(int id) {
        return meatyMapper.informationAndType(id);
    }

    public List soilAndType(int id) {
        return meatyMapper.soilAndType(id);
    }


    public int curingAddViews(int id) {
        return meatyMapper.curingAddViews(id);
    }

    public int meatyAddViews(int id) {
        return meatyMapper.meatyAddViews(id);
    }

    public int informationAddViews(int id) {
        return meatyMapper.informationAddViews(id);
    }

    public int soilAddViews(int id) {
        return meatyMapper.soilAddViews(id);
    }

    public int isMeatyAddSave(int m_id, int u_id) {
        return meatyMapper.isMeatyAddSave(m_id, u_id);
    }

    public int meatyAddSave(int m_id, int u_id) {
        meatyMapper.meatyAddCollect(m_id);
        return meatyMapper.meatyAddSave(m_id, u_id);
    }

    public int meatyCancelSave(int m_id, int u_id) {
        return meatyMapper.meatyCancelSave(m_id, u_id);
    }

    public List meatyListSave(int u_id) {
        return meatyMapper.meatyListSave(u_id);
    }

    public int selectMap(int id, String address, String lng, String lat) {
        return meatyMapper.selectMap(id, address, lng, lat);
    }
    public List getLatLngNameId(String lng, String lat){
        System.out.println("Ss"+lng);
        System.out.println("Ss"+lat);
        return meatyMapper.getLatLngNameId( lng, lat);
    }
}
